package com.googlecode.animator.controller
{

	
	import com.googlecode.data.materials.MaterialVO;
	import com.googlecode.data.objects3d.MaterialsListObject3DVO;
	import com.googlecode.data.objects3d.Object3DVO;
	import com.googlecode.data.objects3d.SingleMaterialObject3DVO;
	
	import org.puremvc.as3.multicore.interfaces.INotification;
		
	/**
	 * Responds to a user setting whether a swf file or an flv has transport controls or not.
	 * @author USER
	 * 
	 */
	public class SetMaterialTransportControlsCommand extends BaseCommand
	{
		/**
		 * Executes command. 
		 * @param notification
		 * 
		 */
		override public function execute(notification:INotification):void
		{
			super.execute(notification);
			
			var object3D:Object3DVO = notification.getBody() as Object3DVO;
			var mat:MaterialVO;
			
			if(object3D is SingleMaterialObject3DVO)
			{
				mat = (object3D as SingleMaterialObject3DVO).material;
			}
			
			if(object3D is MaterialsListObject3DVO)
			{
				mat = (object3D as MaterialsListObject3DVO).materialsList[(object3D as MaterialsListObject3DVO).selectedFace];
			}
			
			settings.setObject3DMaterialTransportControls(object3D.name, mat);
		}
		
	}
}